from urllib import request

# 确认请求网站
url = 'https://www.baidu.com/'

res_url = request.Request(url=url)  # 发起请求

html = request.urlopen(res_url)  # 打开网页
print(html.read().decode('utf-8'))  # 打印网页源代码
